#ifndef _SINGLETON_H
#define _SINGLETON_H

#define NULL 0

template <class S>
class Singleton
{
private:
	static S *s;
	Singleton<S>()	{ }
public:
	S & getInstance()
	{
		if (s==NULL)
			s=new S();
		return *s;
	}
	void destroy()
	{
		if (s!=NULL)
			delete s;
	}
};

#endif
